Skip to content

fix(queue): single-session by default — direct lane assignment, sink drain (#8187) - #8189

Merged
dezren39 merged 2 commits into
mainfrom
queue/8187-8187-lane-direct
Nov 10, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/8187-8187-lane-direct

Conversation

@dezren39

@dezren39 dezren39 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Implements #8187 (broker side, incl. Drews amendments 6776133945 / 6776183066 / 6776188930): no task is assigned to opencode or a specific lane by default and without a specific recorded reason; platform/lane/pool/model/task/session are MARKS — recorded, never a filter or a requirement.

Changes (Turso backend, pkgs/fleet/crates/fleet-queue)

  • Default = direct. verb_lane: the hard-coded 1:1 opencode/direct balancing is removed. Fresh assignment = direct, reason=default_direct on lane_assigned. Opencode ONLY via the new fleet queue lane --opencode-reason <text>, recorded on the new ledger column opencode_reason (schema + additive migration). --exclusion-reason forces direct and wins over --opencode-reason. Platform is NEVER a routing reason (no platform door).
  • Reassignment: an existing opencode ledger row flips to direct on --exclusion-reason unless a session is bound; flip updates the row, re-syncs progress.lane, emits lane_assigned reason=exclusion reassignment=true.
  • Sink drain: default_pick_predicate gains a third branch admitting parked handoff sink rows with NO not_before gate and no new placeholders; lanes claim the stranded sink tasks (+0 attempts) and work them direct. Claimant parked_handoff pick + by-id claim unchanged in shape.
  • Platform demoted to a mark (amendment 2): platform_allows deleted; pick SELECT, claim_update_sql and by_id_claimable no longer filter on platform — a mismatched-platform claim claims the item, a no-platform claim works identically (the claimant claim --platform openchamber --handoff path included). The declared platform is stamped on the claimed row via platform = COALESCE(?, platform) in both claim UPDATEs and carried on the claimed event. New client flag claim --session-id records the claiming sessions id as a mark.
  • Audit marks (amendments 2+3): events are the append-only audit log. audit_marks/with_marks fill task_id, queue, pool (=queue), platform, lane_id, model (claim_provider/model/variant) and session_id into payloads. Extended events: claimed (pick + by-id), lane_assigned (fresh + flip), lane_session_bound, parked, woken, completed, failed. No update/delete path added for events. A future bulk reset can write a queue_reset event through the EXISTING /events-append verb (kind is a free non-empty string; worker/task optional) — no backend op needed.

Audit (per #8187 sharpening)

  • Enqueue stamps NO lane/assignment (progress={}, no ledger row, platform defaults NULL). The opencode claimant (poll.py/claimant.py) only READS progress.lane to discover candidates; it never assigns and has no lane default. verb_lane was the only assignment producer.

Tests

7 #8187 regression tests (default direct; opencode-reason door + recording; flip matrix incl. session-bound never flips; sink branch + placeholder count; platform-not-a-lane-input; platform-not-a-claim-filter: mismatch claims / no-platform claims / mark stamped; claim event carries lane/pool/model/session marks). cargo test -p fleet-queue --all-features: 149 lib + 2 integration passed, 0 failed (laptop-verified).

Review disposition

Codex review hit its usage limit with zero findings (verified: no inline comments, no reviews on the PR). CodeRabbit likewise rate-limited. Basic checks queue for hours and required checks are disabled; merging on laptop-verified targeted tests per the standing #8185 pattern.

Refs #8187

…drain (#8187)

verb_lane (Turso): remove the 1:1 opencode/direct balancing. A fresh assignment is direct by default (reason=default_direct); opencode requires a specific recorded reason via the new --opencode-reason (new ledger column opencode_reason, additive migration), and --exclusion-reason still forces direct (and wins over opencode-reason). The lane_assigned event records reason (default_direct|exclusion|opencode_reason) instead of balancing counts. tasks.platform is a claim-side family filter (openchamber|muse, never a lane), so it does not drive assignment.

Reassignment: an existing unbound opencode ledger row flips to direct when the caller passes --exclusion-reason (update + progress.lane re-sync + lane_assigned event with reassignment=true); session-bound rows never flip; no exclusion = assignment kept.

Sink drain: default_pick_predicate gains a third branch admitting parked handoff sink rows (PARKED_HANDOFF_SQL) with no not_before gate and no new placeholders, so lanes can claim the stranded sink tasks (+0 attempts as parked claims) and work them direct; the claimant parked_handoff pick and by-id claim are unchanged.

Audit: enqueue stamps no lane/assignment (progress {}, no ledger row, platform defaults NULL); the opencode claimant only reads progress.lane, never assigns. verb_lane was the only assignment producer.

Tests: 5 new #8187 regression tests; cargo test -p fleet-queue --all-features: 149 lib + 2 integration passed, 0 failed.
@dezren39
dezren39 requested a review from a team as a code owner November 10, 2026 18:48
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T18:48:35.554980Z
We couldn’t complete this review. Comment @codex review to try again.
4552889 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…vents (#8187 amendments)

Per Drew on #8187 (6776183066, 6776188930): mark the platform, lane, pool and model looking at an item - plus task and session id - but never filter or require.

- Claim demotion: platform_allows deleted; the pick SELECT and claim_update_sql no longer filter on platform, and by_id_claimable takes no platform input. A claim whose platform mismatches an item claims it; a claim with no platform works identically. The declared platform is stamped on the claimed row via platform = COALESCE(?, platform) in both claim UPDATEs and carried on the claimed event. verb_lane door unchanged: opencode only via --opencode-reason; platform is never a routing reason.
- Audit marks: new audit_marks/with_marks helpers fill task_id, queue, pool (=queue), platform, lane_id, model (claim_provider/model/variant) and session_id (progress binding / explicit claim --session-id, new client flag) into event payloads. Events extended: claimed (pick + by-id), lane_assigned (fresh + reassignment flip), lane_session_bound, parked, woken, completed, failed. Events table stays append-only; no update/delete path added.
- Tests: platform_is_a_mark_not_a_claim_filter_8187 (mismatch claims, no-platform claims, mark stamped, no filter survives) and claim_event_carries_lane_pool_model_session_marks_8187 (marks content, explicit-wins, null-when-absent, with_marks source oracle). Suite: 149 lib + 2 integration passed, 0 failed.
@dezren39
dezren39 merged commit 9337c79 into main Nov 10, 2026
1 of 4 checks passed
@dezren39
dezren39 deleted the queue/8187-8187-lane-direct branch November 10, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant